/**
 * @a https://leetcode.cn/problems/is-unique-lcci
 */
#include "common.h"

class Solution
{
public:
    bool isUnique(string astr)
    {
        if (astr.size() > 'z' - 'a' + 1)
            return false;
        int bitmap = 0;
        for (auto ch : astr)
        {
            int i = ch - 'a';
            int detect = 1 << i;
            if (bitmap & detect)
                return false;
            else
                bitmap |= detect;
        }
        return true;
    }
};